package com.ch.servlet;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Arrays;

@WebServlet(name = "YourItemServlet", value = "/YourItemServlet")
public class YourItemServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        final String edu = request.getParameter("edu");
        //数值型参数
        final String[] likes = request.getParameterValues("likes");
        //设置请求对象字符集
        request.setCharacterEncoding("utf-8");
        //设置响应对象字符集
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html;charset=utf-8");
        PrintWriter writer = response.getWriter();
        writer.println("你的学历:"+edu);
        writer.println("<br>");
        writer.println("你的爱好:"+ Arrays.toString(likes));
        writer.println("<br>");
    }
}
